// https://nuxt.com/docs/api/configuration/nuxt-config
import AutoImport from "unplugin-auto-import/vite";
import vuetify from 'vite-plugin-vuetify'
// vs code 编辑器配置

export default defineNuxtConfig({
        ssr: false,
        app: {
            keepalive: true,
        },
        // 自动引入
        imports: {
            autoImport: true
        },
        runtimeConfig: {
            // 需要写在public里面，否则客户端无法访问
            public: {
                baseUrl: process.env.BASE_URL,
                basellmUrl: process.env.NUXT_PUBLIC_BASELLM_URL,
                wxauthredirectUri: process.env.NUXT_PUBLIC_WXAUTHREDIRECT_URI,
                wxauthAppid: process.env.NUXT_PUBLIC_WXAUTH_APPID,
                baseApiurl: process.env.NUXT_PUBLIC_BASE_APIURL,
                baseSocketurl: process.env.NUXT_PUBLIC_BASE_SOCKETURL,
                baseVitsurl: process.env.NUXT_PUBLIC_BASE_VITSURL,
                baseChatttsurl: process.env.NUXT_PUBLIC_BASECHATTTSURL,
                payBaseurl: process.env.NUXT_PUBLIC_PAY_BASEURL,
                paySocket: process.env.NUXT_PUBLIC_PAY_SOCKET,
                // ossRegion: process.env.NUXT_PUBLIC_OSS_REGION,
                // ossBucket: process.env.NUXT_PUBLIC_OSS_BUCKET,
                // ossSecret: process.env.NUXT_PUBLIC_OSS_SECRET,
                // ossKey: process.env.NUXT_PUBLIC_OSS_KEY,
                // minioEndpoint: process.env.NUXT_PUBLIC_MINIO_ENDPOINT,
                // minioPort: process.env.NUXT_PUBLIC_MINIO_PORT,
                // minioAccessKey: process.env.NUXT_PUBLIC_MINIO_ACCESSKEY,
                // minioSecretKey: process.env.NUXT_PUBLIC_MINIO_SECRETKEY,
                // minioBucket: process.env.NUXT_PUBLIC_MINIO_BUCKET,
                // minioDomain: process.env.NUXT_PUBLIC_MINIO_DOMAIN,

            }
        },
        routeRules: {
            "/ai/*": {
                ssr: false
            },
            "/edit/*": {
                ssr: false
            }
        },
        // extends: ['@nuxt/ui-pro'],
        modules: [
            '@pinia/nuxt',
            '@pinia-plugin-persistedstate/nuxt',
            'vuetify-nuxt-module',
            '@nuxtjs/color-mode',
            'nuxt-icon',
            '@nuxtjs/i18n',
            '@ant-design-vue/nuxt',
            'nuxt-primevue',
            // '@nuxtjs/dotenv',
            // "nuxt-electron"
            '@vueuse/nuxt',
            // "@nuxt/ui",
        ],
        // electron: {
        //     build: [
        //         {
        //             // Main-Process entry file of the Electron App.
        //             entry: 'electron/main.ts',
        //         }
        //     ]
        // },
        primevue: {
            // usePrimeVue:true,
            // cssLayerOrder: 'reset,primevue',
            // cssLayerOrder: 'tailwind-base, primevue, tailwind-utilities'
            /* Options */
            // cssLayerOrder: "tailwind-base, primevue, tailwind-utilities",
            options: {
                ripple: true
            },
            components: {
                exclude: ["Editor", "Chart"]
            }
        },
        // css: ['primevue/resources/themes/aura-light-green/theme.css'],
        i18n: {
            vueI18n: 'i18n.config.ts' // if you are using custom path, default
        },
        // vuetify: {
        //     moduleOptions: {
        //         /* module specific options */
        //     },
        // },
        vue: {
            propsDestructure: true,
        },
        vite: {
            esbuild: {
                drop: ['debugger'],
                // pure: ['console.log', 'console.error', 'console.warn', 'console.debug', 'console.trace'],
            },
            server: {
                proxy: {
                    // "/api": {
                    //     target: "http://127.0.0.1:3001",
                    //     changeOrigin: true,
                    //     rewrite: (path) => path.replace(/^\/api/, "")
                    // },
                    // "/websocket": {
                    //     target: "http://127.0.0.1:8188",
                    //     changeOrigin: true,
                    //     ws: true,
                    //     rewrite: (path) => path.replace(/^\/websocket/, "")
                    // },
                    // "/socket.io": {
                    //     target: "http://127.0.0.1:3002/socket.io",
                    //     changeOrigin: true,
                    //     ws: true,
                    //     rewrite: (path) => path.replace(/^\/socket.io/, "")
                    // },
                    // "/vits": {
                    //     target: "http://127.0.0.1:5000",
                    //     changeOrigin: true,
                    //     rewrite: (path) => path.replace(/^\/vits/, "")
                    // }
                }
            },
            plugins: [
                AutoImport({
                    imports: ["vue", "vue-router", "pinia"],
                    dts: 'auto-import.d.ts', // 指明 .d.ts 文件的位置和文件名
                }),],
        },
        css: ["~/assets/css/main.scss"],
        devtools: {enabled: true},
    }
)